package com.example.shoppingmall.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class Urlconfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
//        registry.addViewController("/Billoflading").setViewName("/order/Billoflading");
        registry.addViewController("/").setViewName("/login/login");
        registry.addViewController("/login").setViewName("/login/login");
        registry.addViewController("/index").setViewName("index");
        registry.addViewController("/photo").setViewName("photo");
    }

    //配置虚拟文件路径的映射
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/images/**").addResourceLocations("file:D:/shoppingmall/src/main/resources/static/images/");
        registry.addResourceHandler("/Path/**").addResourceLocations("file:D:/Backup/Downloads");
    }
}
